//
//  SettlementViewController.m
//  OrderFood
//
//  Created by xiaofang wang on 2018/10/24.
//  Copyright © 2018年 zhiyuan. All rights reserved.
//

#import "SettlementViewController.h"
#import "BillCell.h"
@interface SettlementViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView *billTableView;
@property(nonatomic,assign)NSInteger count;
@end

@implementation SettlementViewController

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.name = @"佣金结算账单";
    self.count = 10;
    self.rightStr_0 = NSLocalizedString(@"lishi", nil);
    // 初始化UI
    [self setupUI];
    
}

- (void)requestNewData{
    [self ls_headerEndRefreshing];
}
- (void)requestMoreData{
    if (self.count < 30) {
        self.count+=10;
        [self.mytableview reloadData];
        [self ls_footerEndRefreshing];
    }else{
        [self.mytableview.mj_footer endRefreshingWithNoMoreData];
    }
    

}

//历史账单
-(void)right_1_action{
    
    
}

// 初始化UI
- (void)setupUI{
    [self loadTableViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-SafeAreaTopHeight-50) tableViewStyle:UITableViewStylePlain refreshStyle:LSRefreshTypeDefault];
    self.mytableview.delegate = self;
    self.mytableview.dataSource = self;
    [self ls_headerBeginRefreshing];
    
    
    UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-SafeAreaTopHeight-50, SCREEN_WIDTH, 50)];
    footerView.backgroundColor = WHITECOLOR;
    [self.view addSubview:footerView];
    [QTTools tool_addLineWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 1) superView:footerView];
    UILabel *unliquidatedLb = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-30, 50)];
    unliquidatedLb.font = FONT(17);
    unliquidatedLb.textAlignment = NSTextAlignmentRight;
    [footerView addSubview:unliquidatedLb];
    NSAttributedString *unliquidatedStr = [QTTools getStrWithAllStr:[NSString stringWithFormat:@"%@%@",NSLocalizedString(@"weijiesuan", nil),@"￥18.0"] rangeStr:@"￥18.0" color:themeColor font:17];
    unliquidatedLb.attributedText = unliquidatedStr;
}


#pragma mark - Table view data source


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.count;
}

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"BillCellId";
    BillCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[BillCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 260;
}



@end
